import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'

// import Layout from '@/views/Layout' // 首页
// import Cuisine from '@/views/cuisine' // 菜品
// import Addmenu from '@/views/cuisine/addmenu' // 增加菜谱
// import Addcuisine from '@/views/cuisine/addcuisine' // 菜品菜品
import Details from '@/views/details' // 点餐明细
import Detailsindex from '@/views/details/index' // 点餐明细

import Accounts from '@/views/accounts' // 账目流水
import Accountsindex from '@/views/accounts/index' // 账目流水

import Staff from '@/views/staff' // 员工管理
import Staffindex from '@/views/staff/index' // 员工管理

import Set from '@/views/set' // 设置
import Setindex from '@/views/set/index' // 设置

// import Aside from '@/views/aside'

// import { Aside } from 'element-ui'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '/',
    redirect: '/Login'
  },
  {
    path: '/Login',
    name: '登录',
    component: Login
  },
  // {
  // path: '/Layout',
  // name: '主页',
  // component: Layout
  // children: [
  //   {
  //     path: '/cuisine',
  //     name: '菜品库',
  //     component: Cuisine,
  //     // meta: { istoken: true }, // 判断是否有token,
  //     children: [
  //       {
  //         path: '/cuisine/addmenu',
  //         name: '增加菜谱',
  //         component: Addmenu
  //         // meta: { istoken: true } // 判断是否有token,
  //       },
  //       {
  //         path: '/cuisine/addcuisine',
  //         name: '增加菜品',
  //         component: Addcuisine
  //         // meta: { istoken: true } // 判断是否有token,
  //       }
  //     ]
  // },
  {
    path: '/details',
    name: '点餐明细',
    component: Details,
    // meta: { istoken: true }, // 判断是否有token, Detailsindex
    children: [
      {
        path: '/details/index',
        name: '点餐明细',
        component: Detailsindex
        // meta: { istoken: true } // 判断是否有token,
      }
    ]
  },
  {
    path: '/accounts',
    name: '账目流水',
    component: Accounts,
    // meta: { istoken: true }, // 判断是否有token,
    children: [
      {
        path: '/accounts/index',
        name: '账目流水',
        component: Accountsindex
        // meta: { istoken: true } // 判断是否有token,
      }
    ]
  },
  {
    path: '/staff',
    name: '员工管理',
    component: Staff,
    // meta: { istoken: true }, // 判断是否有token,
    children: [
      {
        path: '/staff/index',
        name: '员工管理',
        component: Staffindex
        // meta: { istoken: true } // 判断是否有token,
      }
    ]
  },
  {
    path: '/set',
    name: '设置',
    component: Set,
    // meta: { istoken: true }, // 判断是否有token,
    children: [
      {
        path: '/set/index',
        name: '设置',
        component: Setindex
        // meta: { istoken: true } // 判断是否有token,
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL, // 默认路由配置模式 在config里面配置
  routes
})

// 路由前置守卫
router.beforeEach((to, from, next) => {
  next()
})
// 路由后置守卫
router.afterEach((to, from) => {})

export default router
